﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xceed.Words.NET;

namespace Utils
{
    public class DocXHelper
    {
        public readonly DocX _DOC;
        public DocXHelper(string path)
        {
            _DOC = DocX.Create(path);
        }

        public void CreateBookmark(string bookmark)
        {
            var p = _DOC.InsertParagraph(bookmark + "：");
            p.Bold();
            p.AppendBookmark(bookmark);
        }

        public void CreateParagraphBookmark(string text, string bookmark)
        {
            var p = _DOC.InsertParagraph();
            p.AppendBookmark(bookmark);
            p.InsertAtBookmark(text, bookmark);
        }

        public void SaveToWord()
        {
            _DOC.Save();
            _DOC.Dispose();
        }
        public void SaveToWord(string path)
        {
            _DOC.SaveAs(path);
            _DOC.Dispose();
        }
    }
}
